import 'package:flutter/material.dart';
import 'package:flutter_hkzf/routers.dart';

// 无状态组件
class PageContent extends StatelessWidget {
  final String name;

  const PageContent({Key? key, required this.name}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("当前页面:$name")),
      body: ListView(
        children: [
          TextButton(
              onPressed: () {
                Navigator.pushNamed(context, Routes.home);
              },
              child: Text(Routes.home)),
          TextButton(
              onPressed: () {
                Navigator.pushNamed(context, Routes.login);
              },
              child: Text(Routes.login)),
          TextButton(
            onPressed: () {
              Navigator.pushNamed(context, 'not found');
            },
            child: const Text('不存在的页面'),
          ),
          TextButton(
            onPressed: () {
              Navigator.pushNamed(context, 'roomDetail/888');
            },
            child: const Text('房屋详情页 参数888'),
          ),
        ],
      ),
    );
  }
}
